  @include('admin.header');
  <div class="layui-body">
    <!-- 内容主体区域 -->
  <table id="userinfo"  lay-filter="test"></table>
<script type="text/html" id="barDemo">
  <a class="layui-btn layui-btn-mini" lay-event="edit">编辑</a>
</script>

<script type="text/html" id="titleTpl">
  *******
</script>
  <div class="layui-footer">
    © layui.com - 底部固定区域
  </div>
</div>
</body>
</html>
<script type="text/javascript" src="/weixinapp/public/layui/layui/layui.js"></script>
<script>
layui.use('element', function(){
  var element = layui.element;
});
layui.use('table', function(){
  var table   = layui.table;
  table.render({
    url:'/weixinapp/public/index.php/admin/population/getinfo',
    elem:'#userinfo',
    height:500,
    cols:[[
      {checkbox:true},
      {field:'id',title:'ID',width:100,sort:true},
      {field:'popula',title:'中奖概念(单位:%)',width:200},
      {fixed: 'right', width:150, align:'center', toolbar: '#barDemo'} //这里的toolbar值是模板元素的选择器
    ]],
    page:true,
    limits: [10],
    limit: 10 //默认采用60
  });

  table.on('tool(test)', function(obj){ //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
  var data = obj.data; //获得当前行数据
  var layEvent = obj.event; //获得 lay-event 对应的值
  var tr = obj.tr; //获得当前行 tr 的DOM对象
  var id = data['id'];
  if(layEvent === 'edit'){
   var indexone = layer.open({
    type: 2,
    title: '修改',
    maxmin: true,
    shadeClose: true, //点击遮罩关闭层
    area : ['550px' , '520px'],
    shade: [0.65],
    content: '/weixinapp/public/index.php/admin/population/change?id='+id,
    end : function(){
      location.reload();
    }
    })
  }
});

});
</script>